package com.auxgroup.hr.front.site.co.common;

import java.util.List;

import javax.annotation.Resource;

import com.auxgroup.hr.front.site.co.BaseCO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.auxgroup.hr.front.commons.BaseRetCode;
import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsEthnicGrpTbl;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.personnal.EthnicGrpTblService;
import com.auxgroup.hr.front.site.co.BaseCO;

/**
 * 民族CO
 * @author wangchangyun
 * @version 创建时间：180527 
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/ethnicGrpTbl")
public class EthnicGrpTblCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(EthnicGrpTblCO.class);

	@Autowired
	public EthnicGrpTblService ethnicGrpTblService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 获取民族
	 * @param hireId
	 * @return
	 */
	@GetMapping(value = "/getOne")
	public BaseResponseVO getOne(String ethnicGrpCd) {
		logger.info("getEthnicGrpTbl ethnicGrpCd={}",ethnicGrpCd);
		if(StringUtils.isBlank(ethnicGrpCd)){
			buildRespone(BaseRetCode.CODE_ERROR_REQUEST_PARAM_NULL);
		}
		PsEthnicGrpTbl ethnicGrpTbl = ethnicGrpTblService.getEthnicGrpTbl(ethnicGrpCd);
		return buildRespone(ethnicGrpTbl,false);
	}
	
	/**
	 * 获取全部民族
	 * @param rsHireId
	 * @return
	 */
	@GetMapping(value = "/getAll")
	public BaseResponseVO getAll(){
		List<PsEthnicGrpTbl> list = ethnicGrpTblService.getAll();
		return buildRespone(list,false);
	}
	
	

}
